package com.wan.personnel2.common;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author anning
 */
@Component
public class MyMetaHandler implements MetaObjectHandler {
    public void insertFill(MetaObject metaObject) {
        System.out.println("新增填充数据  对日期数据进行填充");
        Object createdate = getFieldValByName("createdate",metaObject);
        if (createdate == null) {
            setFieldValByName("createdate",new Date(),metaObject);
        }
    }

    public void updateFill(MetaObject metaObject) {

    }
}
